/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/triangle
   @Language: C++
   @Datetime: 19-08-23 14:22
   */

class Solution {
public:
	int minimumTotal(vector<vector<int>>& triangle) {
		for(int i=triangle.size()-1; i--;)
			for(int j=0; j<=i; ++j)
				triangle[i][j] += min(triangle[i+1][j],triangle[i+1][j+1]);
		return triangle[0][0];
	}
};
